package cn.com.pushworld.check.btn;

import java.util.ArrayList;

import cn.com.infostrategy.to.mdata.BillVO;
import cn.com.infostrategy.ui.common.UIUtil;
import cn.com.infostrategy.ui.mdata.BillTreePanel;
import cn.com.infostrategy.ui.mdata.WLTActionEvent;
import cn.com.infostrategy.ui.mdata.WLTActionListener;

public class Wlt_CheckCode implements WLTActionListener {

	private BillTreePanel tree_panel;
	public void actionPerformed(WLTActionEvent arg0) throws Exception {
		// TODO Auto-generated method stub
		tree_panel=(BillTreePanel) arg0.getBillPanelFrom();
		
		String code=tree_panel.getSelectedVO().getStringValue("code");
		
		int num=Integer.parseInt(code.substring(2, code.length()));
		
		BillVO[] billvo=tree_panel.getSelectedChildPathBillVOs();
		ArrayList<String>  al_sql=new ArrayList<String>();
		for(int i=1;i<billvo.length;i++){
			String new_code=code.substring(0,2);
			num++;
			new_code=new_code+num;	
			al_sql.add("update  sac_innserflow set code='"+new_code+"' where id="+billvo[i].getStringValue("id")+"");
		}
		
		UIUtil.executeBatchByDS(null, al_sql);
		//tree_panel.refreshTree();
		
	}

}
